package flatlandRPGTest;

import org.lwjgl.util.vector.Vector2f;
import org.lwjgl.input.Keyboard;
import flatlandRPG.TestableKeyboard;
import flatlandRPG.Actor;
import flatlandRPG.GameText;
import flatlandRPG.Player;
import flatlandRPG.ActorManager;
import student.*;

// -------------------------------------------------------------------------
/**
 * Tests the actor manager.
 *
 * @author evant
 * @version May 1, 2011
 */
public class ActorManagerTest
    extends TestCase
{
    private ActorManager testManager;


    public void setUp()
    {
        testManager = new ActorManager(new Player());
    }


    // ----------------------------------------------------------
    /**
     * Tests that the added actor converses correctly when the player is in
     * range and the key is pressed.
     */
    public void testActorManager()
    {
        Actor actor = new Actor(0.1f, 5, new GameText(100), "Test text");
        Actor actor2 = new Actor(0.1f, 5, new GameText(100), "Test text");
        actor2.setLocation(new Vector2f(3, 3));
        testManager.add(actor);
        testManager.add(actor2);

        TestableKeyboard.setKeyDown(Keyboard.KEY_E);
        testManager.doLogic();

        assertTrue(actor.isConversing());
        assertFalse(actor2.isConversing());
    }
}
